<template>
  <a-form @submit="handleSubmit" :form="form" class="form">
    <a-row class="form-row" :gutter="16">
      <a-col :lg="6" :md="12" :sm="24">
        <a-form-item
          label="$t('userTaskForm.rwm')">
          <a-input placeholder="$t('userTaskForm.qsrrwmc')" v-decorator="[ 'name2', {rules: [{ required: true, message: '$t('userTaskForm.qsrrwmc')', whitespace: true}]} ]" />
        </a-form-item>
      </a-col>
      <a-col :xl="{span: 7, offset: 1}" :lg="{span: 8}" :md="{span: 12}" :sm="24">
        <a-form-item
          label="$t('userTaskForm.rwms')">
          <a-input placeholder="$t('userTaskForm.qsrrwms')" v-decorator="[ 'url2', {rules: [{ required: true, message: '$t('userTaskForm.qsrrwms')', whitespace: true}]} ]" />
        </a-form-item>
      </a-col>
      <a-col :xl="{span: 9, offset: 1}" :lg="{span: 10}" :md="{span: 24}" :sm="24">
        <a-form-item
          label="$t('userTaskForm.zxr')">
          <a-select
            placeholder="$t('userTaskForm.qxzzxr')"
            v-decorator="[
              'owner2',
              {rules: [{ required: true, message: '{{ $t('userTaskForm.qxzzxr') }}'}]}
            ]" >
            <a-select-option value="{{ $t('userTaskForm.hll') }}">{{ $t('userTaskForm.hll') }}</a-select-option>
            <a-select-option value="{{ $t('userTaskForm.ldd') }}">{{ $t('userTaskForm.ldd') }}</a-select-option>
          </a-select>
        </a-form-item>
      </a-col>
    </a-row>
    <a-row class="form-row" :gutter="16">
      <a-col :lg="6" :md="12" :sm="24">
        <a-form-item
          label="$t('userTaskForm.zrr')">
          <a-select
            placeholder="$t('userTaskForm.qxzzrr')"
            v-decorator="[
              'approver2',
              {rules: [{ required: true, message: '{{ $t('userTaskForm.qxzzrr') }}'}]}
            ]" >
            <a-select-option value="{{ $t('userTaskForm.ww') }}">{{ $t('userTaskForm.ww') }}</a-select-option>
            <a-select-option value="{{ $t('userTaskForm.lhj') }}">{{ $t('userTaskForm.lhj') }}</a-select-option>
          </a-select>
        </a-form-item>
      </a-col>
      <a-col :xl="{span: 7, offset: 1}" :lg="{span: 8}" :md="{span: 12}" :sm="24">
        <a-form-item
          label="$t('userTaskForm.txsj')">
          <a-time-picker
            style="width: 100%"
            v-decorator="[
              'dateRange2',
              {rules: [{ required: true, message: '{{ $t('userTaskForm.qxztxsj') }}'}]}
            ]" />
        </a-form-item>
      </a-col>
      <a-col :xl="{span: 9, offset: 1}" :lg="{span: 10}" :md="{span: 24}" :sm="24">
        <a-form-item
          label="$t('userTaskForm.rwlx')">
          <a-select
            placeholder="$t('userTaskForm.qxzrwlx')"
            v-decorator="[ 'type2', {rules: [{ required: true, message: '{{ $t('userTaskForm.qxzrwlx') }}'}]} ]" >
            <a-select-option value="{{ $t('userTaskForm.dszx') }}">{{ $t('userTaskForm.dszx') }}</a-select-option>
            <a-select-option value="{{ $t('userTaskForm.zqzx') }}">{{ $t('userTaskForm.zqzx') }}</a-select-option>
          </a-select>
        </a-form-item>
      </a-col>
    </a-row>
    <a-form-item v-if="showSubmit">
      <a-button htmlType="submit" >Submit</a-button>
    </a-form-item>
  </a-form>
</template>

<script>
export default {
  name: 'TaskForm',
  props: {
    showSubmit: {
      type: Boolean,
      default: false
    }
  },
  data () {
    return {
      form: this.$form.createForm(this)
    }
  },
  methods: {
    handleSubmit (e) {
      e.preventDefault()
      this.form.validateFields((err, values) => {
        if (!err) {
          this.$notification['error']({
            message: 'Received values of form:',
            description: values
          })
        }
      })
    }
  }
}
</script>

<style scoped>

</style>
